<template>
  <div>
    <detail-banner :sightName="sightName" :bannerImg="bannerImg" :galleryImgs="galleryImgs"></detail-banner>
    <detail-header></detail-header>
    <detail-list :list="list"></detail-list>
    <div class="content"></div>
  </div>
</template>
<script>
import axios from 'axios'
import DetailBanner from './components/banner'
import DetailHeader from './components/header'
import DetailList from './components/list'
export default {
  name: 'Detail',
  data: function () {
    return {
      list: [],
      sightName: '',
      bannerImg: '',
      galleryImgs: []
    }
  },
  mounted () {
    this.getDetailInfo()
  },
  methods: {
    getDetailInfo: function () {
      axios.get('/api/detail.json?id=' + this.$route.params.id).then(this.getHandleDetailSucc)
    },
    getHandleDetailSucc: function (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.sightName = data.sightName
        this.bannerImg = data.bannerImg
        this.galleryImgs = data.gallaryImgs
        this.list = data.categoryList
      }
    }
  },
  components: {DetailList, DetailHeader, DetailBanner}
}
</script>
<style lang="stylus" scoped>
  .content
    height: 50rem
</style>
